package com.zhisheng.springbootredis.controller;

import com.zhisheng.springbootredis.entity.Student;
import com.zhisheng.springbootredis.service.StudentService;
import com.zhisheng.springbootredis.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;

/**
 * (Student)表控制层
 *
 * @author 杨小龙
 * @since 2025-10-20 18:59:03
 */
@RestController
@RequestMapping("student")
public class StudentController {
    @Autowired
    private StudentService studentService;

    /**
     * 新增数据
     *
     * @param student 实体
     * @return 新增结果
     */
    @PostMapping
    public R<Student> add(@RequestBody Student student) {
        R r=studentService.insert(student);
        return r;
    }
    @GetMapping("/select/{id}")
    public R<Student> select(@PathVariable("id")Integer id) {
        R r = studentService.selectById(id);
        return r;
    }





}

